home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 2
/
Atari Mega Archive CD - Volume 2.iso
/
8bit
/
cislib_b
/
nocaps.doc
< prev
next >
Wrap
Text File
|
1995-04-22
|
5KB
|
223 lines
One thing that drives me CRAZY about
Atari Basic is the fact that you can
only type code in UPPER CASE. Does
this sound familiar? You're typing
along and run across something like:
70 ?"Press any key"
So you shift to lower case to type
the string. But if you're as lazy as
I am, chances are that when you get
to the next line, you type something
like:
80 get #1,a
WHOOPS -ERROR!! GO BACK AND RETYPE
THE LINE...
Now MAC/65 doesn't mind, right? Why
not see if we can get Atari Basic to
be as forgiving?
GETTING STARTED
To install NoCaps, run the Basic
program. The machine language will be
installed on *groan* Page Six. Before
you panic totally, I've posted the
Source Code in this DL (NOCAPS.M65),
so MAC/65 users can at least
re-assemble it to another location if
desired. Meanwhile...
WHAT IT DOES
NoCaps is activated by a USR(1536)
NOCAPS.BAS does this automatically.
It also POKES the memory location
that puts the keyboard into lower
case. When you've RUN the program,
issue a list command. Look at that!
Basic accepts it with no problem. Hit
your 'inverse' key. Type list again.
Hmm...it's in lower case AND inverse,
but it STILL works! What's going on
here???
HOW IT WORKS
To find out, type a new line of
Basic with a line number in lower
case:
1000 dim a$(1)
Now list 1000. Ah hah. Those
lowercase letters you typed have been
mysteriously transformed into UPPER
CASE. THAT'S what NoCaps does. It
intercepts the INPUT, and before
Basic gets a chance to see it, tidies
things up so everything is 'normal'.
Technical notes at the end of this
file...
LIMITATIONS
NoCaps treats just about everything
you type the same way. It converts
lower case to UPPER CASE, and strips
inverse. There's just one exception:
it leaves ANYTHING CONTAINED WITHIN
QUOTES ALONE.
That's good for typing PRINT
commands.
Not so good if you type something
like save"d:program". In that case,
DOS will try to do just that, and
quickly return an error, since it
doesn't know what a "d:" (as opposed
to a "D:") IS. (Actually, there's a
way around that, too. But that's
another program...)
Note: this ALSO means that REM
statements are converted. Well,
nobody's perfect...
**** NoCaps works <ONLY> in
'Immediate Mode'. It's a
'convenience' utility for typing in
programs. If a program is RUNning, it
leaves INPUT alone.
SAFETY FIRST!
Anytime you use a program like this,
there's a chance for disaster. If you
have NoCaps active, and put something
ELSE on Page Six, your computer will
immediately Freeze Up the first time
you try to type anything. (XE owners
can usually recover from that with a
RESET.)
It will ALSO freeze if you try to
execute the USR command while it's
already activated. (careful with that
one.)
The simplest way to disable NoCaps
is just RESET. Or, you can type the
BREAK key. Press it, and your
computer reverts to it's normal mode,
and you're safe.
This isn't quite perfect. MOST of
the time, if you hit BREAK to stop a
program scroll, it'll have no effect.
(FYI, The 'disable' routine sets the
keyboard back to All Caps.) If you
type BREAK to end a program, NoCaps
WILL be disabled.
To make absolutely sure you've got
NoCaps disabled, YOU SHOULD PRESS THE
BREAK KEY AT A 'READY' PROMPT. Or
RESET.
Assuming you've left Page Six alone,
you can turn NoCaps back on by
calling the USR command again:
?USR(1536)
That's it. Chances are, it's not
something you can't live without, but
when you need it...
TECHNICAL NOTES
To start, you need to know how the
Atari handles it's I/O devices, which
is beyond my scope here. See MAPPING
THE ATARI pp. 81-82 (and 221-222 in
the Revised version for XL/XE
modifications) for info on that.
Please note that by using the vector
tables, it's relatively easy to write
a program like this that works on
both an 800 and an XE (there's a
lesson there!)
When you call the USR routine, a
couple of things happen. The address
of the E: handler table is changed
from it's normal location in ROM, to
Page Six. (The disable function works
in reverse. The address of the E:
handler is changed back to it's
original value.) The ROM table is
moved into the NEW table, then we
make a change. Bytes 4 and 5 of any
I/O table point to the GET BYTE
routine. These are changed to point
to the NoCaps code.
Anytime you're typing on your Atari,
each character is saved in the system
buffer at LBUFF ($580). In the normal
course of events, when you hit
RETURN, Basic immediately takes over,
and examines the contents of LBUFF,
checking it for proper syntax. But
we've put in a detour. Our NEW
routine waits for a RETURN. When it
gets one, it checks LBUFF first,
doing the conversions noted above.
Only after it's done, does Basic get
to see the line. And by then, it's
acceptable. Short and sweet.
The only 'trick', is making NoCaps
work in immediate mode, but not
during a RUN. Fortunately, what with
all the JSR's and stuff going on at
any given moment in the OS, the value
of the stack pointer is DIFFERENT in
those two cases. NoCaps knows what
the 'immediate mode' value is. So a
CMP tells it which mode Basic is in.
As noted, the source code (crude as
it is) can be found in NOCAPS.M65 As
always, I hope you can improve it!
Questions? Ask!!
>>don
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD